import React, {Component} from 'react'
import '../../less/index.less'
import {TwsReactMarkdownPreview} from 'tws-antd'
import {FormattedMessage} from 'react-intl'
import {convertContent} from '../../constant/lang-util'


class AssignmentReferenceAnswerBox extends Component {
  render() {
    const {answer} = this.props
    return (<div className='margin-t-3'>
        <h3><FormattedMessage id='参考答案'/></h3>
        {answer
          ? <div className='margin-t-2 mark-down-wrap'>
            <TwsReactMarkdownPreview source={`\`\`\`
${answer}
\`\`\``} />
          </div>
          : <div className='margin-t-2 mark-down-wrap'>
            <TwsReactMarkdownPreview source={convertContent('暂无参考答案')}/>
          </div>}
      </div>
    )
  }
}

export default AssignmentReferenceAnswerBox
